import {
  validateStrByte,
  validateCustomPositiveInt,
  validateCustomADecimal,
  validateCustomTwoDecimal
} from '@/utils/validate.js'
import {
  isNull
} from '@/utils'

export default {
  data() {
    // 校验方法
    // 券名
    const validateCouponName = (rule, value, callback) => {
      if (isNull(value)) {
        callback(new Error('请输入券名称'))
      } else if (!validateStrByte(value, 27)) {
        callback(new Error('长度不超过9个汉字或27个英文数字'))
      } else {
        callback()
      }
    }

    // 面额
    const validateDenomination = (rule, value, callback) => {
      if (this.couponTypeGroup.cash.includes(this.form.couponType)) {
        if (isNull(value)) {
          callback(new Error('请输入面额'))
        } else if (!validateCustomTwoDecimal(value)) {
          callback(new Error('请输入0.01~99999.99'))
        } else if (this.form.transactionMinimum) {
          this.$refs.form.validateField(['transactionMinimum'])
          callback()
        } else {
          callback()
        }
      } else if (this.couponTypeGroup.exchange.includes(this.form.couponType)) {
        if (isNull(value)) {
          callback(new Error('请输入价值'))
        } else if (!validateCustomTwoDecimal(value)) {
          callback(new Error('请输入0.01~9999999.99'))
        } else {
          callback()
        }
      } else {
        callback()
      }
    }

    // 门槛
    const validateTransactionMinimum = (rule, value, callback) => {
      if (this.couponTypeGroup.cash.includes(this.form.couponType)) {
        if (isNull(value)) {
          callback(new Error('请输入门槛'))
        } else if (!validateCustomTwoDecimal(value)) {
          callback(new Error('请输入0.01~99999.99'))
        } else if (validateCustomTwoDecimal(this.form.denomination)) {
          value - this.form.denomination > 0 ? callback() : callback(new Error('可用门槛需大于面额'))
        } else {
          callback()
        }
      } else if (this.couponTypeGroup.discount.includes(this.form.couponType)) {
        if (isNull(value)) {
          callback()
        } else if (!validateCustomTwoDecimal(value)) {
          callback(new Error('请输入0.01~99999.99'))
        } else {
          callback()
        }
      } else if (this.couponTypeGroup.exchange.includes(this.form.couponType)) {
        if (isNull(value)) {
          callback()
        } else if (!validateCustomTwoDecimal(value)) {
          callback(new Error('请输入0.01~99999.99'))
        } else {
          callback()
        }
      }
    }

    // 叠加数量
    const validateMaxUseNum = (rule, value, callback) => {
      if (isNull(value)) {
        callback(new Error('请输入叠加数量'))
      } else if (!validateCustomPositiveInt(value, 2)) {
        callback(new Error('请输入1~99'))
      } else {
        callback()
      }
    }

    // 折扣券折扣
    const validateDiscountPercent = (rule, value, callback) => {
      if (isNull(value)) {
        callback(new Error('请输入折扣'))
      } else if (!validateCustomADecimal(value, 1)) {
        callback(new Error('请输入0.1~9.9'))
      } else {
        callback()
      }
    }

    // 优惠上限
    const validateDiscountMaximum = (rule, value, callback) => {
      if (this.couponTypeGroup.cash.includes(this.form.couponType)) {
        if (isNull(value)) {
          callback(new Error('请输入金额'))
        } else if (!validateCustomTwoDecimal(value)) {
          callback(new Error('请输入0.01~99999.99'))
        } else {
          callback()
        }
      } else if (this.couponTypeGroup.discount.includes(this.form.couponType)) {
        if (isNull(value)) {
          callback()
        } else if (!validateCustomTwoDecimal(value)) {
          callback(new Error('请输入0.01~99999.99'))
        } else {
          callback()
        }
      } else {
        callback()
      }
    }

    // 时间
    const validateDate = (rule, value, callback) => {
      if (!value || value.length !== 2) {
        callback(new Error('请选择日期'))
      } else if (this.form.couponType === 'cash_wx_pay' && this.$momentMini(this.$momentMini(this.$momentMini(value[0]).add(90, 'days'))).isBefore(value[1])) {
        callback(new Error('日期跨度不能大于90天'))
      } else if (value[0] === value[1]) {
        callback(new Error('开始日期不能等于结束日期'))
      } else {
        if (this.form.availableTime.timeType === 4) this.$refs.form.validateField(['availableTime.availableDateList'])
        callback()
      }
    }

    // 时间类型一 多少天可用
    const validateDays = (rule, value, callback) => {
      if (isNull(value)) {
        callback(new Error('请输入天数'))
      } else if (!validateCustomPositiveInt(value, 3)) {
        callback(new Error('请输入1~999'))
      } else {
        callback()
      }
    }

    // 时间类型四 可用日期段
    const validateAvailableDateList = (rule, value, callback) => {
      const startDateArr = []
      const endDateArr = []
      value.some(v => {
        if (!v.date || v.date.length !== 2) {
          callback(new Error('请输入日期区间'))
          return true
        } else if (this.form.date && this.form.date.length === 2 && (v.date[0] + ' 00:00:00' < this.form.date[0] || v.date[1] + ' 23:59:59' > this.form.date[1])) {
          callback(new Error('日期区间不在可用时间内'))
          return true
        }
        if (value.length === 1) {
          callback()
          return true
        } else {
          startDateArr.push(v.date[0])
          endDateArr.push(v.date[1])
        }
      })
      // 排序
      const startDateSortArr = startDateArr.sort()
      const endDateSortArr = endDateArr.sort()
      // 判断交叉重复
      let flag = false
      for (let k = 1; k < startDateSortArr.length; k++) {
        if (startDateSortArr[k] <= endDateSortArr[k - 1]) {
          flag = true
        }
      }
      if (flag) {
        callback(new Error('日期区间存在交叉重叠'))
      } else {
        callback()
      }
    }

    //  时间类型二三四  可用时间段
    const validateAvailableTimeList = (rule, value, callback) => {
      const startTimeArr = []
      const endTimeArr = []
      value.some(v => {
        if (!v.time || v.time.length !== 2) {
          callback(new Error('请输入时间区间'))
          return true
        } else if (value.length === 1) {
          callback()
          return true
        } else {
          startTimeArr.push(v.time[0])
          endTimeArr.push(v.time[1])
        }
      })
      // 排序
      const startTimeSortArr = startTimeArr.sort()
      const endTimeSortArr = endTimeArr.sort()
      // 判断交叉重复
      let flag = false
      for (let k = 1; k < startTimeSortArr.length; k++) {
        if (startTimeSortArr[k] <= endTimeSortArr[k - 1]) {
          flag = true
        }
      }
      if (flag) {
        callback(new Error('时间区间存在交叉重叠'))
      } else {
        callback()
      }
    }

    // 说明
    const validateDescription = (rule, value, callback) => {
      if (isNull(value) && ['cash_wx_busi', 'discount_wx_busi'].includes(this.form.couponType)) {
        callback(new Error('请输入使用说明'))
      } else {
        callback()
      }
    }

    // 总预算 个数
    const validateMaxCoupons = (rule, value, callback) => {
      if (!this.form.maxCouponsChecked) {
        callback()
      } else if (isNull(value)) {
        callback(new Error('请输入限制'))
      } else if (!validateCustomPositiveInt(value, 7, [10000000])) {
        callback(new Error('请输入正整数，范围5~10000000'))
      } else if (value < 5) {
        callback(new Error('请输入正整数，范围5~10000000'))
      }
      if (this.form.maxCouponsByDayChecked && this.form.maxCouponsByDay && validateCustomPositiveInt(this.form.maxCouponsByDay, 7) && +value < +this.form.maxCouponsByDay) {
        callback(new Error('总预算要大于等于日预算'))
      } else {
        this.$refs.form.clearValidate(['maxCouponsByDay'])
        callback()
      }
    }

    // 日预算
    const validateMaxCouponsByDay = (rule, value, callback) => {
      if (!this.form.maxCouponsByDayChecked) {
        callback()
      } else if (isNull(value)) {
        callback(new Error('请输入限制'))
      } else if (!validateCustomPositiveInt(value, 7, [10000000])) {
        callback(new Error('请输入正整数，范围5~10000000'))
      } else if (value < 5) {
        callback(new Error('请输入正整数，范围5~10000000'))
      } else if (this.form.maxCouponsChecked && this.form.maxCoupons && validateCustomPositiveInt(this.form.maxCoupons, 7) && +value > +this.form.maxCoupons) {
        callback(new Error('日预算要小于等于总预算'))
      } else {
        this.$refs.form.clearValidate(['maxCoupons'])
        callback()
      }
    }

    // 日预算
    // const validateMaxAmountByDay = (rule, value, callback) => {
    //   if (!this.form.maxAmountByDayChecked) {
    //     callback()
    //   } else if (isNull(value)) {
    //     callback()
    //   } else if (!validateCustomTwoDecimal(value, 9, [1000000000])) {
    //     callback(new Error('范围0.01~1000000000'))
    //   } else {
    //     callback()
    //   }
    // }

    // 参与对象
    const validateCategory = (rule, value, callback) => {
      if (this.form.userGroup === 3 && value.length === 0) {
        callback(new Error('请选择会员类型'))
      } else {
        callback()
      }
    }

    //  用户天限制
    const validateMaxUserDay = (rule, value, callback) => {
      if (!this.form.maxUserDayChecked) {
        callback()
      } else if (isNull(value)) {
        callback(new Error('请输入限制'))
      } else if (!validateCustomPositiveInt(value, 2, [100])) {
        callback(new Error('请输入正整数，范围1~100'))
      } else if (this.form.maxCouponsChecked && this.form.maxCoupons && validateCustomPositiveInt(this.form.maxCoupons, 7) && +value > +this.form.maxCoupons) {
        callback(new Error('日限制要小于等于总预算'))
      } else {
        this.$refs.form.validateField(['maxUserWeek', 'maxUserMonth', 'maxUserAll'])
        callback()
      }
    }

    //  用户周限制
    const validateMaxUserWeek = (rule, value, callback) => {
      if (!this.form.maxUserWeekChecked) {
        callback()
      } else if (isNull(value)) {
        callback(new Error('请输入限制'))
      } else if (!validateCustomPositiveInt(value, 2, [100])) {
        callback(new Error('请输入正整数，范围1~100'))
      } else if (this.form.maxCouponsChecked && this.form.maxCoupons && validateCustomPositiveInt(this.form.maxCoupons, 7) && +value > +this.form.maxCoupons) {
        callback(new Error('周限制要小于等于总预算'))
      } else if (this.form.maxUserDayChecked && this.form.maxUserDay && validateCustomPositiveInt(this.form.maxUserDay, 10) && +this.form.maxUserDay > +value) {
        callback(new Error('周限制要大于等于日限制'))
      } else {
        this.$refs.form.validateField(['maxUserMonth', 'maxUserAll'])
        callback()
      }
    }

    // 用户月限制
    const validateMaxUserMonth = (rule, value, callback) => {
      if (!this.form.maxUserMonthChecked) {
        callback()
      } else if (isNull(value)) {
        callback(new Error('请输入限制'))
      } else if (!validateCustomPositiveInt(value, 2, [100])) {
        callback(new Error('请输入正整数，范围1~100'))
      } else if (this.form.maxCouponsChecked && this.form.maxCoupons && validateCustomPositiveInt(this.form.maxCoupons, 7) && +value > +this.form.maxCoupons) {
        callback(new Error('月限制要小于等于总预算'))
      } else if (this.form.maxUserWeekChecked && this.form.maxUserWeek && validateCustomPositiveInt(this.form.maxUserWeek, 10) && +this.form.maxUserWeek > +value) {
        callback(new Error('月限制要大于等于周限制'))
      } else if (this.form.maxUserDayChecked && this.form.maxUserDay && validateCustomPositiveInt(this.form.maxUserDay, 10) && +this.form.maxUserDay > +value) {
        callback(new Error('月限制要大于等于日限制'))
      } else {
        this.$refs.form.validateField(['maxUserAll'])
        callback()
      }
    }

    // 用户总限制
    const validateMaxUserAll = (rule, value, callback) => {
      if (!this.form.maxUserAllChecked) {
        callback()
      } else if (isNull(value)) {
        callback(new Error('请输入限制'))
      } else if (['cash', 'discount', 'exchange', 'cash_wx_busi', 'discount_wx_busi'].includes(this.form.couponType) && !validateCustomPositiveInt(value, 2, [100])) {
        callback(new Error('请输入正整数，范围1~100'))
      } else if (['cash_wx_pay'].includes(this.form.couponType) && !/^(?:[1-9]|[1-6][0-9]|60)$/.test(value)) {
        callback(new Error('请输入正整数，范围1~60'))
      } else if (this.form.maxUserMonthChecked && this.form.maxUserMonth && validateCustomPositiveInt(this.form.maxUserMonth, 10) && +this.form.maxUserMonth > +value) {
        callback(new Error('总限制要大于等于月限制'))
      } else if (this.form.maxUserWeekChecked && this.form.maxUserWeek && validateCustomPositiveInt(this.form.maxUserWeek, 10) && +this.form.maxUserWeek > +value) {
        callback(new Error('月限制要大于等于周限制'))
      } else if (this.form.maxUserDayChecked && this.form.maxUserDay && validateCustomPositiveInt(this.form.maxUserDay, 10) && +this.form.maxUserDay > +value) {
        callback(new Error('月限制要大于等于日限制'))
      } else if (this.form.maxCouponsChecked && this.form.maxCoupons && validateCustomPositiveInt(this.form.maxCoupons, 7) && +value > +this.form.maxCoupons) {
        callback(new Error('总限制要小于等于总预算'))
      } else {
        callback()
      }
    }

    // 发券
    const validateSendMerchant = (rule, value, callback) => {
      if (this.form.sendMerchant !== 3) {
        this.$refs.form.clearValidate(['sendMerchantList'])
        callback()
      } else {
        callback()
      }
    }

    const validateSendMerchantList = (rule, value, callback) => {
      if (this.form.sendMerchant === 3 && value.length === 0) {
        callback(new Error('请选择商户'))
      } else {
        callback()
      }
    }

    // 核券
    const validateVerifyMerchant = (rule, value, callback) => {
      if (this.form.verifyMerchant !== 3) {
        this.$refs.form.clearValidate(['verifyMerchantList'])
        callback()
      } else {
        callback()
      }
    }
    const validateVerifyMerchantList = (rule, value, callback) => {
      if (this.form.verifyMerchant === 3 && value.length === 0) {
        callback(new Error('请选择商户'))
      } else {
        callback()
      }
    }

    // 核销商品
    const validateAvailableItems = (rule, value, callback) => {
      if (this.form.availableItemsType === 2 && value.length === 0) {
        callback(new Error('请选择商品'))
      } else {
        callback()
      }
    }

    //  核销业务类型
    const validateVerifyBusiness = (rule, value, callback) => {
      if (this.form.verifyBusinessType === 2 && value.length === 0) {
        callback(new Error('请选择类型'))
      } else {
        callback()
      }
    }

    // 可核销商户号
    const validateVerifyMerchants = (rule, value, callback) => {
      if (isNull(value)) {
        callback(new Error('请输入商户号'))
      } else {
        const arr = value
          .trim()
          .replace(/\r\n|\n|\r/g, ',')
          .replace(/,+/g, ',')
          .split(',')
        const len = arr.length
        // let result = arr.some((v, i) => v.length > 20);
        len > 50 ? callback(new Error('单次最多支持50个')) : callback()
        // result
        //   ? callback(new Error("单个桌台名称长度不超过20个字"))
        //   : callback();
      }
    }

    // 支付类型
    const validateWxPayType = (rule, value, callback) => {
      if (this.form.wxPayTypeType === 2 && value.length === 0) {
        callback(new Error('请选择类型'))
      } else {
        callback()
      }
    }

    // 银行bin
    const validateLimitCardBin = (rule, value, callback) => {
      if (isNull(value)) {
        callback(new Error('请输入bin'))
      } else {
        const arr = value
          .trim()
          .replace(/\r\n|\n|\r/g, ',')
          .replace(/,+/g, ',')
          .replace(/\s*/g, '')
          .split(',')
        const len = arr.length
        let result = false
        result = arr.some((v, i) => {
          console.log(v, /^\d{6,9}$/.test(v))
          return !(/^\d{6,9}$/.test(v))
        })
        if (len > 10) callback(new Error('单次最多支持10个'))
        result
          ? callback(new Error('bin号长度为6到9位数字'))
          : callback()
      }
    }

    return {
      // 校验字段
      rules: {
        // 商户号
        belongMchid: [
          {
            required: true,
            message: '请输入',
            trigger: ['blur', 'change']
          }
        ],
        // 券名
        couponName: [
          {
            required: true,
            validator: validateCouponName,
            trigger: ['blur', 'change']
          }
        ],
        // 券面额
        denomination: [
          {
            required: true,
            validator: validateDenomination,
            trigger: ['blur', 'change']
          }
        ],
        // 门槛金额
        transactionMinimum: [
          {
            required: true,
            validator: validateTransactionMinimum,
            trigger: ['blur', 'change']
          }
        ],
        // 叠加数量
        maxUseNum: [
          {
            required: true,
            validator: validateMaxUseNum,
            trigger: ['blur', 'change']
          }
        ],
        // 折扣
        discountPercent: [
          {
            required: true,
            validator: validateDiscountPercent,
            trigger: ['blur', 'change']
          }
        ],
        // 优惠上限
        discountMaximum: [
          {
            required: true,
            validator: validateDiscountMaximum,
            trigger: ['blur', 'change']
          }
        ],
        // 兑换内容
        exchangeThings: [
          {
            required: true,
            message: '请输入兑换内容',
            trigger: ['blur', 'change']
          }
        ],
        // 可用日期
        date: [
          {
            required: true,
            validator: validateDate,
            trigger: ['blur', 'change']
          }
        ],
        // 时间类型一 多少天可用
        'availableTime.days': [
          {
            required: true,
            validator: validateDays,
            trigger: ['blur', 'change']
          }
        ],
        // 时间类型二 周几可用
        'availableTime.availablePeriodWeek': [
          {
            type: 'array',
            required: true,
            message: '请选择日期',
            trigger: ['blur', 'change']
          }
        ],
        // 时间类型三 几号可用
        'availableTime.availablePeriodDay': [
          {
            type: 'array',
            required: true,
            message: '请选择日期',
            trigger: ['blur', 'change']
          }
        ],
        // 时间类型四 可用日期段
        'availableTime.availableDateList': [
          {
            required: true,
            validator: validateAvailableDateList,
            trigger: ['blur', 'change']
          }
        ],
        // 时间类型二三四 可用时间段
        'availableTime.availableTimeList': [
          {
            required: true,
            validator: validateAvailableTimeList,
            trigger: ['blur', 'change']
          }
        ],
        description: [
          {
            required: false,
            validator: validateDescription,
            trigger: ['blur', 'change']
          }
        ],
        // 总限制 次数
        maxCoupons: [
          {
            required: true,
            validator: validateMaxCoupons,
            trigger: ['blur', 'change']
          }
        ],
        // 总限制 金额
        // maxAmount: [
        //   {
        //     required: true,
        //     validator: validateMaxAmount,
        //     trigger: ['blur', 'change']
        //   }
        // ],
        // 天限制  次数
        maxCouponsByDay: [
          {
            required: true,
            validator: validateMaxCouponsByDay,
            trigger: ['blur', 'change']
          }
        ],
        // 天限制 金额
        // maxAmountByDay: [
        //   {
        //     required: true,
        //     validator: validateMaxAmountByDay,
        //     trigger: ['blur', 'change']
        //   }
        // ],
        // 参与会员等级
        category: [
          {
            type: 'array',
            required: true,
            validator: validateCategory,
            trigger: ['blur', 'change']
          }
        ],
        // 用户日预算
        maxUserDay: [
          {
            required: true,
            validator: validateMaxUserDay,
            trigger: ['blur', 'change']
          }
        ],
        // 用户周预算
        maxUserWeek: [
          {
            required: true,
            validator: validateMaxUserWeek,
            trigger: ['blur', 'change']
          }
        ],
        // 用户月预算
        maxUserMonth: [
          {
            required: true,
            validator: validateMaxUserMonth,
            trigger: ['blur', 'change']
          }
        ],
        // 用户总预算
        maxUserAll: [
          {
            required: true,
            validator: validateMaxUserAll,
            trigger: ['blur', 'change']
          }
        ],
        // 发券
        sendMerchant: [
          {
            required: true,
            validator: validateSendMerchant,
            trigger: ['blur', 'change']
          }
        ],
        // 发券
        sendMerchantList: [
          {
            type: 'array',
            required: true,
            validator: validateSendMerchantList,
            trigger: ['blur', 'change']
          }
        ],
        // 核券
        verifyMerchant: [
          {
            required: true,
            validator: validateVerifyMerchant,
            trigger: ['blur', 'change']
          }
        ],
        // 核券
        verifyMerchantList: [
          {
            type: 'array',
            required: true,
            validator: validateVerifyMerchantList,
            trigger: ['blur', 'change']
          }
        ],
        // 核销商品
        availableItems: [
          {
            type: 'array',
            required: true,
            validator: validateAvailableItems,
            trigger: ['blur', 'change']
          }
        ],
        // 核销业务
        verifyBusiness: [
          {
            type: 'array',
            required: true,
            validator: validateVerifyBusiness,
            trigger: ['blur', 'change']
          }
        ],

        // 小程序APPID
        'verifyMiniprogramConfig.appId': [
          {
            required: true,
            message: '请输入小程序APPID',
            trigger: ['blur', 'change']
          }
        ],
        // 可核销商户号
        verifyMerchants: [
          {
            required: true,
            validator: validateVerifyMerchants,
            trigger: ['blur', 'change']
          }
        ],
        // 支付类型
        wxPayType: [
          {
            required: true,
            validator: validateWxPayType,
            trigger: ['blur', 'change']
          }
        ],
        // 银行卡限制
        limitPay: [
          {
            type: 'array',
            required: true,
            message: '请选择',
            trigger: ['blur', 'change']
          }
        ],
        // 银行卡name
        'limitCard.name': [
          {
            required: true,
            message: '请输入',
            trigger: ['blur', 'change']
          }
        ],
        // 银行卡bin
        'limitCard.bin': [
          {
            required: true,
            validator: validateLimitCardBin,
            trigger: ['blur', 'change']
          }
        ],
        // 背景主题
        theme: [
          {
            required: true,
            message: '请选择背景主题',
            trigger: ['blur', 'change']
          }
        ],
        // 卡包公众号入口
        'customEntrance.appid': [
          {
            required: true,
            message: '请输入公众号APPID',
            trigger: ['blur', 'change']
          }
        ],
        // 卡包小程序APPID
        'customEntrance.miniProgramsAppid': [
          {
            required: true,
            message: '请输入小程序APPID',
            trigger: ['blur', 'change']
          }
        ],
        // 卡包小程序路径
        'customEntrance.miniProgramsPath': [
          {
            required: true,
            message: '请输入小程序路径',
            trigger: ['blur', 'change']
          }
        ],
        // 卡包小程序入口文案
        'customEntrance.entranceWords': [
          {
            required: true,
            message: '请输入入口文案',
            trigger: ['blur', 'change']
          }
        ],
        // 卡包小程序入口文案
        'customEntrance.hallId': [
          {
            required: true,
            message: '请输入入口文案',
            trigger: ['blur', 'change']
          }
        ],
        // 按钮文案
        'functionButtonConfig.word': [
          {
            required: true,
            message: '请输入按钮文案',
            trigger: ['blur', 'change']
          }
        ],
        // 小程序APPID
        'functionButtonConfig.appId': [
          {
            required: true,
            message: '请输入小程序APPID',
            trigger: ['blur', 'change']
          }
        ]

      }
      // 配置
      // 状态
      // 数据
    }
  },
  watch: {
    'form.verifyBusinessType'(newVal) {
      if (newVal === 2 && this.form.verifyBusiness && this.form.verifyBusiness.length === 0) {
        this.form.verifyBusiness = ['9000', '9056']
      }
    }
    // form: {
    //   handler: function (val) {
    //     this.$nextTick(() => {

    //     });
    //   },
    //   deep: true
    // }
    // maxAmountCount(val) {
    //   if (['cash_wx_pay', 'cash_wx_busi'].includes(this.form.couponType)) {
    //     if (validateCustomTwoDecimal(val.denomination, 10) && validateCustomPositiveInt(val.maxCoupons, 10)) {
    //       this.form.maxAmount = (val.maxCoupons * this.$math.mul(val.denomination, 100, 0)) / 100
    //     } else {
    //       this.form.maxAmount = null
    //     }
    //   }
    // },
    // maxAmountByDayCount(val) {
    //   if (['cash_wx_pay', 'cash_wx_busi'].includes(this.form.couponType)) {
    //     if (validateCustomTwoDecimal(val.denomination, 10) && validateCustomPositiveInt(val.maxCouponsByDay, 10)) {
    //       this.form.maxAmountByDay = (val.maxCouponsByDay * this.$math.mul(val.denomination, 100, 0)) / 100
    //     } else {
    //       this.form.maxAmountByDay = null
    //     }
    //   }
    // }
  },
  computed: {
    // maxAmountCount() {
    //   const { maxCoupons, denomination } = this.form
    //   return { maxCoupons, denomination }
    // },
    // maxAmountByDayCount() {
    //   const { maxCouponsByDay, denomination } = this.form
    //   return { maxCouponsByDay, denomination }
    // }
  },
  methods: {}
}
